package com.yp.infrastructure.common.annotation;


import org.springframework.context.annotation.Lazy;
import org.springframework.core.annotation.AliasFor;

import javax.annotation.Resource;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Lazy
@Resource
@Inherited
@Target({FIELD})
@Retention(RUNTIME)
public @interface LazyResource {


    @AliasFor(annotation = Lazy.class)
    boolean value() default true;

    @AliasFor(annotation = Resource.class)
    String name() default "";

    @AliasFor(annotation = Resource.class)
    String lookup() default "";

    @AliasFor(annotation = Resource.class)
    Class<?> type() default Object.class;

    @AliasFor(annotation = Resource.class)
    Resource.AuthenticationType authenticationType() default Resource.AuthenticationType.CONTAINER;

    @AliasFor(annotation = Resource.class)
    boolean shareable() default true;

    @AliasFor(annotation = Resource.class)
    String mappedName() default "";

    @AliasFor(annotation = Resource.class)
    String description() default "";

}
